import { Form, Input } from 'antd';
import React from 'react';

const {TextArea} = Input;

export default (n) => {
    return (
        <td>
            {
                n.editing
                    ? (
                        <Form.Item
                            name={n.dataIndex}
                            style={{
                                margin: 0,
                            }}
                            rules={[
                                {
                                    required: true,
                                    message: `Please Input ${n.title}!`,
                                },
                            ]}
                        >
                            {
                                n.dataIndex === 'answer'
                                    ? <TextArea rows={3}/>
                                    : <Input/>
                            }
                        </Form.Item>
                    )
                    : n.children
            }
        </td>
    )
};